if(!this.r929){
	this.r929	=	{};
}

(function(){
	var head	=	document.getElementsByTagName('head')[0];
	
	var callbackMap	=	{};
	var failCallbackMap	=	{};
	
	var idCount	=	0;
	
	var nullCallback	=	function(data){};
	var nullFileCallback	=	function(errMsg){};
	
	this.r929.jsonp	=	function(url, param, callback, failCallback, timeout){
		if(!url){
			return;
		}
		
		var info	=	{};
		switch(typeof(url)){
			case 'string':
				info.url	=	url;
				if(timeout){
					switch(typeof(timeout)){
					case 'number':
						info.timeout	=	timeout;
						break;
					}
				}
				if(failCallback){
					switch(typeof(failCallback)){
					case 'number':
						info.timeout	=	failCallback;
						break;
					case 'function':
						info.failCallback	=	failCallback;
					}
				}
				if(callback){
					switch(typeof(callback)){
					case 'number':
						info.timeout	=	callback;
						break;
					case 'function':
						if(param && typeof(param)=="function"){
							info.failCallback	=	callback;
						}else if(!param){
							info.failCallback	=	callback;
						}else{
							info.callback	=	callback;
						}
					}
				}
				if(param){
					switch(typeof(param)){
					case 'number':
						info.timeout	=	param;
						break;
					case 'function':
						info.callback	=	param;
					case 'object':
						info.param	=	param;
					}
				}
			break;
		
			case 'object':
				info	=	url;
			break;
		
			default:
				return;
		}
		
		
		if(!info.url || typeof(info.url)!='string'){
			return;
		}
		if(!info.callback){
			info.callback	=	nullCallback;
		}
		if(!info.failCallback){
			info.failCallback	=	nullFileCallback;
		}
		if(!info.timeout){
			info.timeout	=	r929.jsonp.timeout;
		}
		
		
		idCount	=	idCount + 1;
		
		callbackMap['f'+idCount]	=	info.callback;
		failCallbackMap['f'+idCount]	=	info.failCallback;
		
		var src	=	url+"?callback=r929.jsonp.CBD&callbackId=f"+idCount;
		if(info.param){
			for(var p in info.param){
				src	=	src+'&'+p+'='+info.param[p];
			}
		}
		
		var script	=	document.createElement("script");
		script.setAttribute('type', 'text/javascript');
		script.setAttribute('src', encodeURI(src));
		
		head.appendChild(script);
		
		setTimeout('r929.jsonp.timeoutTime("'+'f'+idCount+'")', info.timeout);
	};
	
	this.r929.jsonp.callbackDispatcher	=	function(data, callbackId){
		if(failCallbackMap[callbackId]){
			if(data[r929.jsonp.errMsgTag]){
				failCallbackMap[callbackId](data[r929.jsonp.errMsgTag]);
			}else{
				callbackMap[callbackId](data[r929.jsonp.resultTag]);
			}
			delete callbackMap[callbackId];
			delete failCallbackMap[callbackId];
		}
	};
	
	this.r929.jsonp.timeoutTime	= function(callbackId){
		if(failCallbackMap[callbackId]){
			failCallbackMap[callbackId]('timeout');
			delete callbackMap[callbackId];
			delete failCallbackMap[callbackId];
		}
	};
	
	this.r929.jsonp.timeout	=	300000;
	
	this.r929.jsonp.resultTag	=	"result";
	this.r929.jsonp.errMsgTag	=	"errMsg";
	
	this.r929.jsonp.CBD	=	this.r929.jsonp.callbackDispatcher;
	
})();